package com.my.json.sensitive.config;

import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
import com.my.json.sensitive.annotation.SensitiveField;

import java.lang.annotation.Annotation;

/*
* 临时不需要过滤的时候取消过滤
ObjectMapper showAllMapper = new ObjectMapper();
showAllMapper.setAnnotationIntrospector(new DisablingMaskFieldIntrospector());
System.out.println(showAllMapper.writeValueAsString(new Person()));
*
* */
public class DisablingMaskFieldIntrospector extends JacksonAnnotationIntrospector {

    @Override
    public boolean isAnnotationBundle(Annotation ann) {
        if (ann.annotationType().equals(SensitiveField.class)) {
            return false;
        } else {
            return super.isAnnotationBundle(ann);
        }
    }

}